<template>
  <PageWrapper title="">
    <template #headerContent>
      <a-card hoverable title="工作台" bordered>
      <a-row align="middle">
        <a-col span="2"><a-avatar :size="72">超级用户</a-avatar></a-col>
        <a-row>
          <a-col>sadsdas</a-col>
        </a-row>
        <a-row>
          <a-col offset="0">
            <a-col alig>{{tip()}} 星期二</a-col>
          </a-col>
        </a-row>
        
      </a-row>
    </a-card>
    </template>
    

    <GrowCard/>
  </PageWrapper>

  <!-- <div class="p-4">
    <a-card hoverable title="工作台" bordered>
      <p>
        <a-list item-layout="horizontal" :data-source="data">
          <template #renderItem="{ item }">
            <a-list-item>
              <a-list-item-meta
                description="Ant Design, a design language for background applications, is refined by Ant UED Team"
              >
                <template #title>
                  <a href="https://www.antdv.com/">{{ item.title }}</a>
                </template>
                <template #avatar>
                  <a-avatar src="https://joeschmoe.io/api/v1/random" />
                </template>
              </a-list-item-meta>
            </a-list-item>
          </template>
        </a-list>
      </p>
    </a-card>
  </div> -->

</template>

<script lang="ts" setup name="Dashboard">
import XEUtils from "xe-utils";
import GrowCard from './components/GrowCard.vue';
import { PageWrapper } from '/@/components/Page';



const tip = () => {
  var date = new Date();
  var day = date.getDay();
  var names = ["周日","周一","周二","周三","周四","周五","周六"];
  return `${getTimeState()}今天是：${XEUtils.toDateString(new Date(), 'yyyy年MM月dd日')} ${names[day]}`
}


let getTimeState = () => {
  // 获取当前时间
  let timeNow = new Date();
  // 获取当前小时
  let hours = timeNow.getHours();
  // 设置默认文字
  let text = ``;
  // 判断当前时间段
  if (hours >= 0 && hours <= 10) {
      text = `早上好`;
  } else if (hours > 10 && hours <= 14) {
      text = `中午好`;
  } else if (hours > 14 && hours <= 18) {
      text = `下午好`;
  } else if (hours > 18 && hours <= 24) {
      text = `晚上好`;
  }
  // 返回当前时间段对应的状态
  return text;
};


</script>
